<link rel="stylesheet" href="$request.contextPath/res/assets/css/colorbox.css"/>
<!-- #section:basics/content.breadcrumbs -->
<div class="breadcrumbs" id="breadcrumbs">
    <script type="text/javascript">
        try {
            ace.settings.check('breadcrumbs', 'fixed')
        } catch (e) {
        }
    </script>

    <ul class="breadcrumb">
        <li>
            <i class="ace-icon fa fa-home home-icon"></i>
            <a href="$request.contextPath">乐哈小游戏</a>
        </li>
        <li>
            <a href="$request.contextPath/posts">项目列表</a>
        </li>
        <li class="active">项目预览</li>
    </ul>
    <!-- /.breadcrumb -->


    <!-- /section:basics/content.searchbox -->
</div>
<form class="form-horizontal" role="form" id="submitForm" action="./posts/save">
    <input type="hidden" id="fileList" name="fileList"/>
    <!-- /section:basics/content.breadcrumbs -->
    <div class="page-content">
        <div class="page-header">
            <div class="row middle">
                <div class="col-xs-4">
                    &nbsp;
                </div>
                <div class="col-xs-8 text-right">
                    <button class="btn btn-prev" type="button" onclick="load('./project/list')">
                        <i class="ace-icon fa fa-arrow-left"></i>
                        返回
                    </button>
                    <button type="button" class="btn btn-danger" onclick="deleteProject('$!proj.projectId')">
                        <i class="ace-icon fa fa-trash-o bigger-120 "></i>删除
                    </button>
                </div>
            </div>
        </div>
        <!-- /.page-header -->
        <div class="row">
            <div class="col-sm-12  col-xs-12 ">

                <div class="message-content" id="id-message-content">
                    <!-- #section:pages/inbox.message-header -->
                    <div class="message-header clearfix">
                        <div class="pull-left">
                            <span class="blue bigger-125">$!proj.projectName</span>

                            <div class="space-4"></div>
                            <i class="ace-icon fa fa-heart middle red"></i>
                            <span class="time grey">10</span>

                            &nbsp;
                            <i class="ace-icon fa fa-user bigger-110  middle green"></i>
                            <span class="time grey">$!sender.nickname</span>

                            &nbsp;
                            <i class="ace-icon fa fa-clock-o bigger-110 orange middle"></i>
                            <span class="time grey">$date.format('yyyy-MM-dd HH:mm', ${proj.projectCreatetime})</span>
                        </div>
                    </div>

                    <!-- /section:pages/inbox.message-header -->
                    <div class="hr"></div>

                    <!-- #section:pages/inbox.message-body -->
                    <div class="message-body">
                        <p>
                            $!proj.projectContent
                        </p>
                    </div>

                    <!-- /section:pages/inbox.message-body -->
                    <div class="hr"></div>
                    <!-- /section:pages/inbox.message-attachment -->
                </div>
                <!-- /.message-content -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>
</form>
<!-- /.page-content -->
<script src="$request.contextPath/res/assets/js/jquery.colorbox.js"></script>

</body>
<script>
    function deleteProject(pId) {
        confirm('确认删除?', function () {
            $.ajax({
                type: "GET",
                url: './project/delete',
                data: {projectId: pId},
                success: function (data) {
                    if (data.resultCode == 0) {
                        succ('删除成功！');
                        delay(function () {
                            load('./project/list');
                        }, 1000);
                    } else {
                        error('删除失败！');
                    }
                },
                dataType: 'JSON'
            });
        });
    }

    $(function () {
        var $overflow = '';
        var colorbox_params = {
            rel: 'colorbox',
            reposition: true,
            scalePhotos: true,
            scrolling: false,
            previous: '<i class="ace-icon fa fa-arrow-left"></i>',
            next: '<i class="ace-icon fa fa-arrow-right"></i>',
            close: '&times;',
            current: '{current} of {total}',
            maxWidth: '100%',
            maxHeight: '100%',
            onOpen: function () {
                $overflow = document.body.style.overflow;
                document.body.style.overflow = 'hidden';
            },
            onClosed: function () {
                document.body.style.overflow = $overflow;
            },
            onComplete: function () {
                $.colorbox.resize();
            }
        };

        $('.ace-thumbnails [data-rel="colorbox"]').colorbox(colorbox_params);
        $("#cboxLoadingGraphic").html("<i class='ace-icon fa fa-spinner orange fa-spin'></i>");//let's add a custom loading icon


    });
</script>